package com.ajie.utils;
import java.util.Random;


/**
 * 获取6位随机字符串
 */
public class RandomString {
    
    /**
     * 方法1：生成随机数字和字母组合
     * @param length
     * @return
     */
    public static String getCharAndNumr(int length) {
        
        Random random = new Random();
        
        StringBuffer valSb = new StringBuffer();
        
        String charStr = "0123456789abcdefghijklmnopqrstuvwxyz";
        
        int charLength = charStr.length();
        
        
        
        for (int i = 0; i < length; i++) {
            
            int index = random.nextInt(charLength);
            
            valSb.append(charStr.charAt(index));
            
        }
        
        return valSb.toString();
        
    }
    
}
